<template>

    <el-container>
        <el-header id="manageHeader" height="90px">
            <!-- 搜索表单 -->
            <el-form :inline="true" :model="searchBase" class="demo-form-inline" style="margin-top: 1.5%;">
                <el-form-item label="论文名">
                    <el-input v-model="searchBase.thesisName" placeholder="论文名" style="width: 160px;">
                    </el-input>
                </el-form-item>
                <el-form-item label="论文时间">
                    <el-date-picker v-model="thesisTime" type="monthrange" range-separator="至" start-placeholder="开始月份"
                        end-placeholder="结束月份" value-format="yyyyMM">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="论文级别">
                    <el-select v-model="value" style="width:90px" placeholder="请选择">
                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onsubmit">查询</el-button>
                </el-form-item>
                <!-- 导出数据为Excel-->
                <el-form-item>
                    <el-button type="primary">导出Excel</el-button>
                </el-form-item>
            </el-form>
        </el-header>
        <el-main>
            <template>
                <el-table :data="thesisData" style="width: 100%">
                    <el-table-column prop="thesisNO" label="论文编号" align="center">
                    </el-table-column>
                    <el-table-column prop="thesisName" label="论文名" align="center">
                    </el-table-column>
                    <el-table-column prop="thesisDate" label="发表时间" align="center">
                    </el-table-column>
                    <el-table-column prop="thesisJour" label="所属期刊" align="center">
                    </el-table-column>
                    <el-table-column prop="category" label="论文类别" align="center">
                    </el-table-column>
                    <el-table-column prop="thesisauthor" label="论文作者" align="center">
                    </el-table-column>
                    <el-table-column prop="thesisEnclosure" label="论文附件" align="center">
                    </el-table-column>
                </el-table>
            </template>
            <!--分页工具条-->
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                :current-page="currentPage" :page-sizes="[5, 10, 15, 20]" :page-size="5"
                layout="total, sizes, prev, pager, next, jumper" :total="totalCount">
            </el-pagination>

        </el-main>
    </el-container>
</template>

<script>
import axios from "axios";

export default {
    name: 'Leaderthesis',
    data() {
        return {
            // 接受学院的信息
            academyName: '',
            // 搜索的表单
            searchBase: {
                thesisName: "",
                category: "",
               
            }, options: [{
                value: "自然科学",
                label: '自然科学'
            }, {
                    value: "社会科学",
                    label: '社会科学'
                },{
                value: "",
                label: '无'
            }],
            value: "",
            // 统计表格数据
            thesisData: [],
            thesisTime:'',
            // 分页
            totalCount: 0,

            // 当前页码
            currentPage: 1,
            pageSize: 5,
        }

    },
    mounted() {
       
        this.selectAll();
     

    },
    methods: {
        onsubmit() {
            this.searchBase.category = this.value
            this.selectAll()

        },
        selectAll() {

            axios({
                method: "post",
                url: " http://localhost:8888/Teachersystem/leadTeacher/selectByPage?currentPage=" + this.currentPage + "&pageSize=" + this.pageSize +  "&thesisTime=" + this.thesisTime,
                data: this.searchBase
            }).then(resp => {
                this.tableData = resp.data.rows;
                this.totalCount = resp.data.totalCount;
            })
        },


        // 分页操作
        handleSizeChange(val) {
            // console.log(`每页 ${val} 条`);
            this.pageSize = val;
            this.selectAll();
        },
        handleCurrentChange(val) {
            // console.log(`当前页: ${val}`);
            this.currentPage = val;
            this.selectAll();
        }
    },
}


</script>

<style>
</style>